package com.gxy.learn.design.model.behaviour.command;

import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.List;

/**
 * @description: 服务员类 请求者角色
 * @author: gaoxueyong
 * @Date: 2022/11/8 14:47
 */
@Slf4j
public class Waitor {

//    持有多个命令对象
    private List<Command> commands = new ArrayList<>();

    public void setCommand(Command command){
        commands.add(command);
    }

//    发起命令 订单来了
    public void orderUp(){
        log.info("美女服务员：大厨，来订单了！");
        for (Command command : commands) {
            command.execute();
        }
    }
}
